package com.test.mytest.servlet;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class ClientUrl {
	public static void main(String[] args) throws Exception {
		URL url = new URL("http://127.0.0.1:8899/ss/");
		HttpURLConnection con = (HttpURLConnection) url.openConnection();
		con.setRequestMethod("POST");
		con.setRequestProperty("Content-Type", "application/octet-stream"); 
		con.setDoOutput(true);
		con.setDoInput(true);
		con.setUseCaches(false); 
		OutputStream os = con.getOutputStream();
		os.write("qweasd".getBytes());
		InputStream is = con.getInputStream();
		while (true) {
			byte[] b = new byte[1024];
			int read = is.read(b);
			System.out.println(read + "============" + new String(b));
		}
	}
}
